set(
	HDRS
	algorithm.h
	iterator.h
	memory.h
)

if(NOT CMAKE_VERSION VERSION_LESS 3.19)
	add_library(std INTERFACE ${HDRS})
else()
	add_library(std INTERFACE)
	add_custom_target(std_sources SOURCES ${HDRS})
endif()

if(NOT CMAKE_VERSION VERSION_LESS 3.8)
	target_compile_features(std INTERFACE cxx_std_11)
endif()

target_include_directories(
	std
	INTERFACE
	$<BUILD_INTERFACE:${rl_BINARY_DIR}/src>
	$<BUILD_INTERFACE:${rl_SOURCE_DIR}/src>
	$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}/rl-${PROJECT_VERSION}>
)

install(FILES ${HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rl-${PROJECT_VERSION}/rl/std COMPONENT development)

if(NOT CMAKE_VERSION VERSION_LESS 3.19)
	set_target_properties(
		std
		PROPERTIES
		VERSION ${PROJECT_VERSION}
	)
endif()

install(
	TARGETS std
	EXPORT rl
	ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT development
	LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtime NAMELINK_SKIP
	RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime
)
